// Package sysin
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2025 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.11
package sysin

import (
	"context"
	"hotgo/internal/model/entity"
	"hotgo/internal/model/input/form"

	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/os/gtime"
)

// ReceiverAddressUpdateFields 修改收货地址字段过滤
type ReceiverAddressUpdateFields struct {
	MemberId     int64       `json:"memberId"     dc:"用户ID"`
	UserName     string      `json:"userName"     dc:"收货人姓名"`
	ProvinceName string      `json:"provinceName" dc:"省/自治区/直辖市"`
	PostalCode   string      `json:"postalCode"   dc:"邮编"`
	CityName     string      `json:"cityName"     dc:"市"`
	CountyName   string      `json:"countyName"   dc:"县/区"`
	StreetName   string      `json:"streetName"   dc:"街道"`
	DetailInfo   string      `json:"detailInfo"   dc:"详细收货地址信息（包括街道地址）"`
	TelNumber    string      `json:"telNumber"    dc:"收货人手机号码"`
	CreatedAt    *gtime.Time `json:"createdAt"    dc:"创建时间"`
	UpdatedAt    *gtime.Time `json:"updatedAt"    dc:"更新时间"`
}

// ReceiverAddressInsertFields 新增收货地址字段过滤
type ReceiverAddressInsertFields struct {
	MemberId     int64       `json:"memberId"     dc:"用户ID"`
	UserName     string      `json:"userName"     dc:"收货人姓名"`
	ProvinceName string      `json:"provinceName" dc:"省/自治区/直辖市"`
	PostalCode   string      `json:"postalCode"   dc:"邮编"`
	CityName     string      `json:"cityName"     dc:"市"`
	CountyName   string      `json:"countyName"   dc:"县/区"`
	StreetName   string      `json:"streetName"   dc:"街道"`
	DetailInfo   string      `json:"detailInfo"   dc:"详细收货地址信息（包括街道地址）"`
	TelNumber    string      `json:"telNumber"    dc:"收货人手机号码"`
	CreatedAt    *gtime.Time `json:"createdAt"    dc:"创建时间"`
	UpdatedAt    *gtime.Time `json:"updatedAt"    dc:"更新时间"`
}

// ReceiverAddressEditInp 修改/新增收货地址
type ReceiverAddressEditInp struct {
	entity.ReceiverAddress
}

func (in *ReceiverAddressEditInp) Filter(ctx context.Context) (err error) {
	// 验证用户ID
	if err := g.Validator().Rules("required").Data(in.MemberId).Messages("用户ID不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	// 验证收货人姓名
	if err := g.Validator().Rules("required").Data(in.UserName).Messages("收货人姓名不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	// 验证省/自治区/直辖市
	if err := g.Validator().Rules("required").Data(in.ProvinceName).Messages("省/自治区/直辖市不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	// 验证市
	if err := g.Validator().Rules("required").Data(in.CityName).Messages("市不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	// 验证详细收货地址信息（包括街道地址）
	if err := g.Validator().Rules("required").Data(in.DetailInfo).Messages("详细收货地址信息不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	// 验证收货人手机号码
	if err := g.Validator().Rules("required").Data(in.TelNumber).Messages("收货人手机号码不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	return
}

type ReceiverAddressEditModel struct{}

// ReceiverAddressDeleteInp 删除收货地址
type ReceiverAddressDeleteInp struct {
	Id interface{} `json:"id" v:"required#主键ID不能为空" dc:"主键ID"`
}

func (in *ReceiverAddressDeleteInp) Filter(ctx context.Context) (err error) {
	return
}

type ReceiverAddressDeleteModel struct{}

// ReceiverAddressViewInp 获取指定收货地址信息
type ReceiverAddressViewInp struct {
	Id int64 `json:"id" v:"required#主键ID不能为空" dc:"主键ID"`
}

func (in *ReceiverAddressViewInp) Filter(ctx context.Context) (err error) {
	return
}

type ReceiverAddressViewModel struct {
	entity.ReceiverAddress
}

// ReceiverAddressListInp 获取收货地址列表
type ReceiverAddressListInp struct {
	form.PageReq
	Id                  int64         `json:"id"                  dc:"主键ID"`
	UserName            string        `json:"userName"            dc:"收货人姓名"`
	TelNumber           string        `json:"telNumber"           dc:"收货人手机号码"`
	CreatedAt           []*gtime.Time `json:"createdAt"           dc:"创建时间"`
	AdminMemberId       int64         `json:"adminMemberId"       dc:"管理员ID"`
	AdminMemberNickname string        `json:"adminMemberNickname" dc:"微信昵称"`
}

func (in *ReceiverAddressListInp) Filter(ctx context.Context) (err error) {
	return
}

type ReceiverAddressListModel struct {
	Id                  int64       `json:"id"                  dc:"主键ID"`
	MemberId            int64       `json:"memberId"            dc:"用户ID"`
	UserName            string      `json:"userName"            dc:"收货人姓名"`
	ProvinceName        string      `json:"provinceName"        dc:"省/自治区/直辖市"`
	CityName            string      `json:"cityName"            dc:"市"`
	CountyName          string      `json:"countyName"          dc:"县/区"`
	StreetName          string      `json:"streetName"          dc:"街道"`
	DetailInfo          string      `json:"detailInfo"          dc:"详细收货地址信息（包括街道地址）"`
	TelNumber           string      `json:"telNumber"           dc:"收货人手机号码"`
	CreatedAt           *gtime.Time `json:"createdAt"           dc:"创建时间"`
	UpdatedAt           *gtime.Time `json:"updatedAt"           dc:"更新时间"`
	AdminMemberId       int64       `json:"adminMemberId"       dc:"管理员ID"`
	AdminMemberRealName string      `json:"adminMemberRealName" dc:"真实姓名"`
	AdminMemberNickname string      `json:"adminMemberNickname" dc:"微信昵称"`
}
